Part Number Hot Search : 
7C135 Z13D5 227M00 DDTC1 K2320 MAX63 PUMH9125 2SB16
Product Description
Full Text Search
 

To Download AN111 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  application note AN111 AN111-1 using the xicor x5163/x5323/x5643 cpu supervisors with the 68hc11 microcontroller by applications staff, september 1998 description the following code demonstrates how xicor's cpu super- visors with eeprom can be interfaced to the 68hc11 microcontroller when connected as shown in figure 1. the circuit uses the 68hc11s built-in spi port with the pd4/sck pin connected to the serial clock (sck), the pd3/mosi pin connected to serial data in (si), the pd2/ miso pin connected to serial data out (so), and the pd5/ pcs0/cs pin connected to chip select (cs ). the spi interface of the cpu supervisors operate at 2mhz, so the 68hc11 can operate the spi port at the maximum speed. this code allows the 68hc11 to read and write data from the eeprom and select eeprom block lock configura- tions. it also allows the 68hc11 to change the watchdog timer settings (if available) or turn off the watchdog timer. more information additional code can be found on the xicor www site at http://www.xicor.com. figure 1. interfacing the xicor cpu supervisors to the 68hc11 microcontroller using the spi port x5163, x5168 x5323, x5328 x5643, x5648 30 xt 29 ex 39 reset 41 irq 40 xirq 8 pa 0 reset 7 pa 1 6 pa 2 17 pe0 18 pe1 19 pe2 20 pe3 22 vrh 21 vrl0 5 pa 3 4 pa 4 3 pa 5 2 pa 6 1 pa 7 16 pb0 15 pb1 14 pb2 13 pb3 12 pb4 11 pb5 10 pb6 9 pb7 31 pc0 32 pc1 33 pc2 34 pc3 35 pc4 36 pc5 37 pc6 38 pc7 42 pd0 43 pd1 44 pd2 2 45 pd3 46 pd4 5 6 47 pd5 25 moda 24 modb 27 e 26 as 28 r/w 1 u? 7 3 r? 10k reset vcc u? so si sck cs reset wp
xicor application note AN111-2 AN111 ******************************************************************************** ** description: ** the purpose of this program is to show the use of the m68hc11 ** assembly language to program the xicor cpu supervisor device. the "wip" ** status polling (ackpol program) is a unique feature of the spi memories. ** the processor interfaces the eeprom through its serial peripheral ** interface port (spi). the sck pin is connected to the serial clock (sck), ** mosi to serial data in(si), miso to the serial data out (so), and pcs0/cs ** to the cs input of the eeprom. the main section of the code calls up other ** modules in order to demonstrate the procedure to be followed when ** reading/writing from/to the device. routines are provided that write and ** read data to/from the status register, including blocklock and watchdog ** timer bits. ** ** this code supports the following supervisory products: ** ** x5163, x5165, x5168, x5169* ** x5323, x5325, x5328, x5329* ** x5643, x5645, x5648, x5649* ** ** * these devices have no watchdog timer, so write 0 to the wdx bits. ******************************************************************************* ******************************************************************************* * internal ram locations addrl equ $ff memory address low byte addrh equ addrl-1 memory address high byte pattern equ addrh-1 pattern register stack equ pattern-1 stack top * constants wren_cmd equ 006 write enable write_cmd equ 002 write data to eeprom read_cmd equ 003 read eeprom data wrdi_cmd equ 006 write disable rdsr_cmd equ 005 read status register command wrsr_cmd equ 001 write status register command dummy equ $ff dummy status of mosi pin during byte read spe_bit equ $40 spif_bit equ $80 bit position of the spif ce_bit equ $20 bit position for pcs0/cs * equates for use with index offset = $1000 portd equ $08 ddrd equ $09 spcr equ $28 spdr equ $2a spsr equ $29 baud equ $2b scdat equ $2f scsr equ $2e sccr2 equ $2d stat_byte equ $00 turn off blocklock, set wdt=1.4s * assembler requirement- cpu type p68h11 page * start of user code org $e000 test: lds #stack * load stack pointer ldx #$1000 * set register base * initialize the spi ldaa #$3f staa ddrd,x * port-d pins all set as outputs ldaa #$50 staa spcr,x * mode = 0, clk = 1mhz ldaa #$00 staa pattern * data pattern to write
- 3 AN111 ldy #$100 sty addrh * memory address to write tab * recall the data pattern ldy addrh * load the memory address jsr wr_byte * write the byte jsr ack_poll * wait till device complets internal write jsr rd_byte * read the byte * ldab #stat_byte * get the status byte jsr wr_status * write the status jsr ack_poll * wait till device complets internal write jmp * ******************************************************************************* *** name: ee_wren *** description: enable write operation to the eeprom *** function: this program sends out the command to enable the writes and *** the store operations to the eeprom *** calls: none *** input: none *** output: none *** register usage: b ******************************************************************************* ee_wren: bclr portd,x,#ce_bit * activate ce ldaa #wren_cmd * write enable command jsr outbyt * output the command bset portd,x,#ce_bit * deactivate ce rts ******************************************************************************* *** name: outbyt *** description: sends a byte to the eeprom *** function: this program shifts out a byte, msb first to the eeprom. *** calls: none *** input: a = byte to be sent *** return value: none *** register usage: none ******************************************************************************* outbyt: staa spdr,x outbyt1: brclr spsr,x,#spif_bit,outbyt1 *wait for last one to complete rts ******************************************************************************* *** name: rd_byte *** description: reads content of the eeprom at a specific location. *** function: this program sends out the command to read the content of a memory *** location specified in the (e) register. *** calls: ee_read_cmd, outbyt *** input: y = address of the byte *** output: b = read value *** register usage: b ******************************************************************************* rd_byte: bclr portd,x,#ce_bit * activate ce jsr ee_read_cmd * issue read command pshy * save addr tsy ldaa 0,y * recall the msb of address jsr outbyt * send it to eeprom ldaa 1,y * recall the lsb of address jsr outbyt * send it to eeprom ldaa #dummy * shift in the data from eeprom jsr outbyt ldaa spdr,x * load received data from spi bset portd,x,#ce_bit * deactivate ce puly
- 4 AN111 rts ******************************************************************************* *** name: ee_read_cmd *** description: sends the read command to the eeprom *** function: this program sends a read command to the eeprom *** calls: outbyt *** input: e = byte address *** return value: a = received byte *** register usage: b, e, iz ******************************************************************************* ee_read_cmd: ldaa #read_cmd * send read command to the eeprom jmp outbyt * send the command ******************************************************************************* *** name: wr_byte *** description: writes a byte to the eeprom at a specific location. *** function: this program writes the byte in the (b) register to the eeprom *** location specified by the (e) register. *** calls: ee_wren, ee_write_cmd, outbyt *** input: y = byte address, b = data to write *** output: none *** register usage: a,b ******************************************************************************* wr_byte: jsr ee_wren * send write enable command bclr portd,x,#ce_bit * activate ce jsr ee_write_cmd * issue write command pshy * save addr tsy ldaa 0,y * recall the msb of address jsr outbyt * send it to eeprom ldaa 1,y * recall the lsb of address jsr outbyt * send it to eeprom tba jsr outbyt * send it to eeprom bset portd,x,#ce_bit * deactivate ce puly * recall addr rts ******************************************************************************* *** name: ee_write_cmd *** description: sends the write command to the eeprom *** function: this program creats the write command sequence and transmits *** it to the eeprom. *** calls: outbyt *** input: y = byte address *** return value: none *** register usage: a ******************************************************************************* ee_write_cmd: ldaa #write_cmd * send write command to the eeprom jmp outbyt ******************************************************************************* *** name: wr_status *** description: writes a byte to the cpu supervisor status register. *** function: this program writes the byte in the (b) register to the status *** register. since the command determines the address, no address is sent. *** the data sent controls the operation of the blocklock, incircuit *** programmable rom and watchdog timer functions (if available). the content *** of the byte sent is: *** *** *** msb lsb *** wpen x wd1 wd0 bl1 bl0 wel wip *** *** calls: ee_wren, ee_wrsr_cmd, outbyt *** input: y = byte address, b = data to write *** output: none
- 5 AN111 *** register usage: a,b ******************************************************************************* wr_status: jsr ee_wren * send write enable command bclr portd,x,#ce_bit * activate ce jsr ee_wrsr_cmd * issue write status command tba * get the status byte jsr outbyt * send it to eeprom bset portd,x,#ce_bit * deactivate ce rts ******************************************************************************* *** name: ee_wrsr_cmd *** description: sends the write command to the eeprom *** function: this program creats the write command sequence and transmits *** it to the eeprom. *** calls: outbyt *** input: y = byte address *** return value: none *** register usage: a ******************************************************************************* ee_wrsr_cmd: ldaa #wrsr_cmd * send write command to the eeprom jmp outbyt ******************************************************************************* *** name: ack_poll *** description: verifies if the eeprom is ready and accepting commands *** function: this program sends the status register read command to the *** eeprom and returns to the caller when the wip bit in the status *** byte is cleared or the maximum number of retries is reached. *** this routine can also be used to read the status of the wdx and *** blx bits. *** calls: outbyt *** input: none *** return value: none *** register usage: a,b ******************************************************************************* ack_poll: ackpol1: bclr portd,x,#ce_bit * activate ce ldaa #rdsr_cmd * read status command jsr outbyt * send the command ldaa #dummy * dummy command jsr outbyt * send the command bset portd,x,#ce_bit * deactivate ce ldaa spdr,x * load received data from spi asra bcc ackpol1 rts org $fffe fdb test end


▲Up To Search▲   

 
Price & Availability of AN111

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X